<?php
namespace JsonRpc\Services\Storage;
use JsonRpc\Models\SysUser;
use JsonRpc\Models\Warehouse;
use JsonRpc\Services\CommonService;
use JsonRpc\Utils\Utils;

/**
 *  用户
 * @author walkor <worker-man@qq.com>
 */
class WarehouseService
{
    use CommonService;

    private static function getBaseModel(){
        return "JsonRpc\\Models\\Warehouse";
    }

    public static function ping(){
        return 'OK';
    }

   public static function saveData($params){
        if(isset($params['id']) && $params['id']){
            //更新
            $model = Warehouse::find($params['id']);

        }else{
            //新增
            unset($params['id']);
            $model = new Warehouse();
            $model->client_id = 1;
            $model->org_id = 1;
        }
       $model->name = $params['name'];
       $model->province_id = $params['province_id'];
       $model->city_id = $params['city_id'];
       $model->area_id = $params['area_id'];
       $model->area_info = $params['area_info'];
       $model->address = $params['address'];
       $model->contact = $params['contact'];
       $model->contact_way = $params['contact_way'];
       return $model->save();
    }
}
